package com.liu.AllAnnotation;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.After;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;


@Aspect
public class DiyCutPointCutAnnotation {

    @Before("execution(* com.liu.AllAnnotation.Person.*(..))")
    public void cut(){
        System.out.println("@Before之前");
    }
    @After("execution(* com.liu.AllAnnotation.Person.*(..))")
    public void after(){
        System.out.println("@After之后");
    }
    @Around("execution(* com.liu.AllAnnotation.Person.*(..))")
    public void around(ProceedingJoinPoint proceedingJoinPoint) throws Throwable {//ProceedingJoinPoint连接点，和切入点一样，就是能够返回值
        System.out.println("环绕通知");
        System.out.println(proceedingJoinPoint.proceed());//执行方法
        System.out.println(proceedingJoinPoint.getKind());
        System.out.println("环绕通知结束");
    }
}
